/**
 * 压缩文件无须引入会自动加入此内容
 */
var script = document.currentScript;
var _QQ_KEY = script.getAttribute('qq-key');

function addressConvertLocation(address, fn) {
    $.ajax({
        url: 'https://apis.map.qq.com/ws/geocoder/v1/',
        type: 'GET',
        data: {
            key: _QQ_KEY,
            output: 'jsonp',
            address: address
        },
        dataType: "jsonp",
        success: function (res) {
            if (res.status != 0) return;
            fn(res.result);
        }
    });
}

function locationConvertAddress(location, fn) {
    $.ajax({
        url: 'https://apis.map.qq.com/ws/geocoder/v1/',
        type: 'GET',
        data: {
            key: _QQ_KEY,
            output: 'jsonp',
            location: location,
            get_poi: 1
        },
        dataType: "jsonp",
        success: function (res) {
            if (res.status != 0) return;
            fn(res.result);
        }
    });
}